# 用来定义异步任务代码
from celery_tasks.sms.yuntongxun.sms import CCP
from . import constans
from celery_tasks.main import celery_app
import logging


# logger = logging.getLogger('django')


@celery_app.task(name='send_sms_code')  # 用装饰器装饰函数为celery异步任务
def send_sms_code(mobile, sms_code):
    # logger.info(sms_code)
    # 利用容联云通讯SDK 发送验证码
    # CCP().send_template_sms(self, to, datas, temp_id):
    CCP().send_template_sms(mobile, [sms_code, constans.SMS_CODE_REDIS_EXPIRES // 60], constans.SMS_CODE_TEMPLATE_ID)